﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;

namespace FundamentalsClass
{
    public static class Helpers
    {
        public static T GetAttribute<T>(this Assembly asm) where T : Attribute
        {
            if (asm == null) { throw new ArgumentNullException("asm"); }
            var attrs = asm.GetCustomAttributes(typeof(T), false);
            if (attrs.Length != 1)
            {
                throw new ApplicationException(
                  String.Format("Found {0} instances of {1} in {2}. Expected 1",
                    attrs.Length, typeof(T).Name, asm.FullName));
            }
            return (T)(attrs[0]);
        } 

    }
}